package com.he.demo.yyt.mz;

import cn.hutool.core.date.DateUtil;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

import java.util.Date;

/**
 * @author heyanjing
 * date:2022-04-18 2022/4/18:11:39
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class WsMzPatient {
    private String IDTypeCode;
    private String PatientCard;
    private String Address;
    private String InsureCardNo;
    private String Sex;
    private String IDTypeDesc;
    private String DocumentID;
    private String SexCode;
    private String PatientName;
    private String Mobile;
    private String AccInfo;
    private String DOB;
    private String AccInfoBalance;
    private String PatientID;
    private String YBFlag;
    private String PatTypeCode;
    private String AccInfoNo;
    private String TelephoneNo;
    private String IDNo;
    private String PatType;

    public MzPatient toMzPatient(){
        MzPatient p=new MzPatient();
        p.setPatient_id(PatientID);
        p.setCardno(PatientCard);
        p.setPatient_name(PatientName);
        p.setIdno(IDNo);
        p.setSex(Sex);
        p.setDate_birth(DOB);
        if(StringUtils.isNotBlank(DOB)){
            p.setAge(DateUtil.betweenYear(DateUtil.parseDate(DOB),new Date(),false)+"");
        }
        p.setPhone(TelephoneNo);
        p.setAddress(Address);
        return p;
    }
}
